﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;

namespace NuGet.Enterprise.Server.Xml
{
    public class XmlContentReader
        : XmlWrappingReader
    {
        private readonly static XmlNodeType[] BlacklistedNodeTypes = new XmlNodeType[]
                                                            {
                                                                XmlNodeType.Comment,
                                                                XmlNodeType.ProcessingInstruction,
                                                                XmlNodeType.XmlDeclaration
                                                            };

        public XmlContentReader(XmlReader baseReader)
            : base(baseReader)
        { }

        public override bool Read()
        {
            var success = base.Read();

            while (success && BlacklistedNodeTypes.Contains(NodeType))
            {
                success = base.Read();
            }

            return success;
        }
    }
}